// ============================================================================
// 路由配置
// ============================================================================

import { createHashRouter, Navigate } from 'react-router-dom'
import { Layout } from '../components/Layout'
import { ErrorBoundary } from '../components/ui/error-boundary'
import { AccountManagePage } from '../pages/AccountManagePage'
import { TasksPage } from '../pages/TasksPage'
import { SchedulerPage } from '../pages/SchedulerPage'
import TaskLogsPage from '../pages/TaskLogsPage'
import { WeiboDataPage } from '../pages/WeiboDataPage'
import { UserDataPage } from '../pages/UserDataPage'
import { KeywordWindowPage } from '../pages/KeywordWindowPage'

/**
 * 应用路由配置
 */
export const router = createHashRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        index: true,
        element: <Navigate to="/accounts" replace />
      },
      {
        path: 'accounts',
        element: <AccountManagePage />
      },
      {
        path: 'tasks',
        element: <TasksPage />
      },
      {
        path: 'scheduler',
        element: <SchedulerPage />
      },
      {
        path: 'logs',
        element: <TaskLogsPage />
      },
      {
        path: 'weibo-data',
        element: <WeiboDataPage />
      },
      {
        path: 'user-data',
        element: <UserDataPage />
      },
      {
        path: 'keyword-windows',
        element: <KeywordWindowPage />
      }
    ]
  }
])

/**
 * 路由路径常量
 */
export const ROUTES = {
  ACCOUNTS: '/accounts',
  TASKS: '/tasks',
  SCHEDULER: '/scheduler',
  LOGS: '/logs',
  WEIBO_DATA: '/weibo-data',
  USER_DATA: '/user-data',
  KEYWORD_WINDOWS: '/keyword-windows'
} as const
